<!--
 * @Descripttion: 本文件是
 * @Author: MZFE_George
 * @Date: 2020-09-14 19:20:00
 * @LastEditors: MZFE_George
 * @LastEditTime: 2020-09-15 16:03:46
-->
<template>
  <div id="app">
    <HelloWorld @calcu="calcu" @calcuall="calcuall" />

    <div class="result" v-show="showResult">
      <div>总收入{{ list2[0].toFixed(2) }}</div>
      <div>总成本{{ list2[1].toFixed(2)}}</div>
      <div>总利润{{ list2[2].toFixed(2)}}</div>
    </div>
    <div class="list">
      <div class="list-item bold">
        <div>单号</div>
        <div>非快递成本</div>
        <div>重量</div>
        <div>实收</div>
        <div>快递成本</div>
      </div>
      <div class="list-item" v-for="item in list" :key="item.express">
        <div>{{ item.express }}</div>
        <div>{{ item.cost }}</div>
        <div>{{ item.weight }}</div>
        <div>{{ item.money }}</div>
        <div>{{ item.expresscost }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import HelloWorld from "./components/HelloWorld.vue";

export default {
  name: "App",
  components: {
    HelloWorld
  },
  data() {
    return {
      list: [],
      list2: [0, 0, 0],
      showResult: false
    };
  },
  methods: {
    calcu(data) {
      this.list = data;
    },
    calcuall(data) {
      this.list2 = data;
      this.showResult = true;
    }
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.list {
}
.list-item {
  display: flex;
}
.bold {
  font-weight: bold !important;
}
.result {
  display: flex;
}
.result div {
  width: 33%;
}
.list-item div {
  width: 20%;
  box-sizing: border-box;
  border: 1px solid #cdcdcd;
}
</style>
